package com.chinatsp.onlineapp.ui.violation;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;

import com.chinatsp.onlineapp.R;
import com.chinatsp.onlineapp.base.BaseActivity;
import com.chinatsp.onlineapp.base.Config;
import com.chinatsp.onlineapp.presenter.QueryViolationDao;
import com.chinatsp.onlineapp.utils.ActivityUtil;

/**
 * 违章查询
 */
public class QueryViolationActivity extends BaseActivity implements View.OnClickListener {

	private ImageView ivEngineNumHelp;
	private ImageView ivEngineNumHelpBottom;
	private Button btnQuery;
	private ViewGroup tvSelectCity;
	private ImageView ivBack;
	private CheckBox cbxRead;
	private QueryViolationDao queryViolationDao;

	@Override
	public void onRequestSuccess(int requestCode) {
		super.onRequestSuccess(requestCode);
		// 开始更新UI
		showProgress(false);
		if (requestCode == Config.CODE_QUERY_VIOLATION){
			
		}
			
	}

	@Override
	public void onRequestFailed(String errorNo, String errorMessage) {
		super.onRequestFailed(errorNo, errorMessage);
		// 开始更新UI
		showProgress(false);
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_query_violation);
		initView();
	}

	private void initView() {
		ivEngineNumHelp = (ImageView) findViewById(R.id.iv_engine_num_help);
		ivEngineNumHelpBottom = (ImageView) findViewById(R.id.iv_engine_num_help_bottom);
		btnQuery = (Button) findViewById(R.id.btn_query);
		tvSelectCity = (ViewGroup) findViewById(R.id.tv_select_city);
		ivBack = (ImageView) findViewById(R.id.iv_back);
		cbxRead = (CheckBox) findViewById(R.id.cbx_read);
		cbxRead.setChecked(true);

		queryViolationDao = new QueryViolationDao(this, this);
		String carNum = "2874052783";
		showProgress(true);
		queryViolationDao.getQueryViolation(carNum);
		
		ivEngineNumHelp.setOnClickListener(this);
		ivEngineNumHelpBottom.setOnClickListener(this);
		btnQuery.setOnClickListener(this);
		tvSelectCity.setOnClickListener(this);
		ivBack.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_query:
			ActivityUtil.intentActivity(QueryViolationActivity.this, QueryViolationLogActivity.class, null);
			break;
		case R.id.iv_engine_num_help:
			ActivityUtil.intentActivity(QueryViolationActivity.this, HelpActivity.class, null);
			break;
		case R.id.iv_engine_num_help_bottom:
			ActivityUtil.intentActivity(QueryViolationActivity.this, HelpActivity.class, null);
			break;
		case R.id.tv_select_city:
			ActivityUtil.intentActivity(QueryViolationActivity.this, SelectCityActivity.class, null);
			break;
		case R.id.iv_back:
			finish();
			break;
		}
	}
}
